let target = {
  filed1: 'filed1',
  filed2: {
    name: 'zhen',
    age: 28,
  },
  filed3: [
    {
      sno: '20126808',
      sname: 'wz',
    },
    {
      sno: '20126809',
      sname: 'wz2',
    },
  ],
  filed4: undefined,
}
target.target = target

function cloneObj(target, map = new Map()) {
  if (typeof target === 'object') {
    let cloneTarget = Array.isArray(target) ? [] : {}
    if (map.get(target)) {
      return map.get(target)
    }
    map.set(target, cloneTarget)
    for (let key in target) {
      cloneTarget[key] = cloneObj(target[key], map)
    }
    return cloneTarget
  } else {
    return target
  }
}

let newTarget = cloneObj(target)
newTarget.filed3[1] = []
console.log('newTarget==', newTarget)
console.log('target==', target)
